<template>
  <el-container class="app-container">
    <el-aside width="30%">
      <Kanban :key="1" :list="list" class="kanban todo" header-text="Announcements" />
    </el-aside>
    <el-container>
      <el-header style="padding: 0 0 0 2rem;text-align: center">
        <mallki style="font-size: 35px" text="Welcome to GOJ !" />
      </el-header>
      <el-main style="padding: 0 0 0 2rem;margin-top: 2rem">
        <el-carousel :interval="4000" height="500px">
          <el-carousel-item v-for="item in imgList" :key="item">
            <el-link :href="item.link" :target="item.target===1?'_blank':'_self'">
              <div class="circle-border">
                <div class="img-container">
                  <img :src="item.src" style="width: 100%;height: 100%;" alt="图片丢失了">
                  <div class="img-textbox">
                    <p class="img-text">{{ item.description }}</p>
                  </div>
                </div>
              </div>
            </el-link>
          </el-carousel-item>
        </el-carousel>
        <el-card style="margin-top: 2rem">
          <line-chart />
        </el-card>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import LineChart from './components/LineChart'
import Mallki from '@/components/TextHoverEffect/Mallki'
import { listTopic } from '@/api/topic'
import Kanban from '@/components/Kanban'
import { listNews } from '@/api/news'

export default {
  components: { LineChart, Mallki, Kanban },
  data() {
    return {
      imgList: [],
      list: [
        { topicId: 1, nick: '不如守中', time: '2021-04-05', title: '测试内容1!', content: 'It has been extactly one year since we initiate NOJ, thank you for your support!' }
      ]
    }
  },
  mounted() {
    listTopic().then(res => {
      this.imgList = res.data.records
    })
    listNews().then(res => {
      this.list = res.data.records
    })
  }
}
</script>

<style scoped lang="scss">

.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 500px;
  text-align: center;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}

.circle-border {
  background-color: transparent;
}

.img-container {
  position: relative;
  overflow: hidden;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.img-container .img-textbox {
  position: absolute;
  top: 0;
  left: -2px;
  width: 101%;
  height: 100%;
  /*transform: scale(0);*/
  opacity: 0;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-color: rgba(0, 0, 0, 0.55) !important;
  box-shadow: inset 0px 0px 10px 4px rgba(255, 255, 255, .75);
  transition: all 0.5s ease;
  display: flex;
}

.img-container:hover .img-textbox {
  /*transform: scale(1);*/
  opacity: 1;
}

.img-text {
  color: #fff;
  /*padding-top: 25%;*/
  font-size: 20px;
  font-weight: 400;
  margin: auto;
}

.kanban {
  &.todo {
    .board-column-header {
      background: #4A9FF9;
    }
  }
}

</style>
